/* eslint-disable */
'use strict';

const Service = require('egg').Service;

class SelectService extends Service {
    async province() {
        const { app } = this;
        return await new Promise((res) => {
            setTimeout(() => {
                res([
                    "湖北省",
                    "湖南省"
                ]);
            }, 1500);
        })
    }

    async city(province) {
        const { app } = this;
        return await new Promise((res) => {
            setTimeout(() => {
                switch (province) {
                    case '湖北省':
                        res([
                            '武汉市',
                            '孝感市',
                            '黄冈市'
                        ])
                        break
                    case '湖南省':
                        res([
                            '长沙市'
                        ])

                        break
                    default:
                        res([])
                        break
                }
            }, 1500);
        })

    }

    async state(city) {
        const { app } = this;
        return await new Promise((res) => {
            setTimeout(() => {
                switch (city) {
                    case '武汉市':
                        res([
                            '江夏区',
                            '武昌区',
                            '洪山区',
                            '江汉区',
                            '江岸区',
                        ])
                        break
                    case '孝感市':
                        res([
                            '孝感区1',
                            '孝感区2',
                            '孝感区3',
                            '孝感区4',
                            '孝感区5',
                        ])
                        break
                    case '黄冈市':
                        res([
                            '蕲春',
                            '黄州',
                            '溪水',
                            '麻城',
                        ])
                        break
                    case '长沙市':
                        res([
                            '长沙区1',
                            '长沙区2',
                            '长沙区3',
                            '长沙区4',
                        ])
                        break
                    default:
                        res([])
                        break
                }
            }, 1500);
        })

    }
}

module.exports = SelectService;